package com.fivetiger.service.impl;

import com.fivetiger.dao.SupplierDao;
import com.fivetiger.entity.Goods;
import com.fivetiger.entity.Supplier;
import com.fivetiger.service.inte.SupplierService;
import com.fivetiger.util.RUtil;
import com.fivetiger.vo.PageBean;
import com.fivetiger.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SupplierServiceImpl implements SupplierService {
    @Autowired
    private SupplierDao dao;

    @Override
    public R save(Supplier supplier) {
        if (supplier != null){
            if (dao.insert(supplier) > 0){
                return RUtil.ok();
            }
        }
        return RUtil.fail();
    }

    @Override
    public PageBean query() {
        List<Supplier> list = dao.select();
        return new PageBean(0,"",list.size(),list);
    }
}
